/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p2a;

/**
 *
 * @author Chaker
 */
public class RuleAux extends Rule
{
    private int anomaly;
    
    public static final int PROTOCOL=1;
    public static final int SRC_IP=2;
    public static final int SRC_PORT=3;
    public static final int DEST_IP=4;
    public static final int DEST_PORT=5;
    public static final int ACTION=6;
    public static final int FIELDS_NB=6;
    
    public RuleAux(Rule rule)
    {
        this.setAction(rule.getAction());
        this.setProtocol(rule.getProtocol());
        this.setSrcIp(rule.getSrcIp());
        this.setSrcPort(rule.getSrcPort());
        this.setDestIp(rule.getDestIp());
        this.setDestPort(rule.getDestPort());
        this.setOrder(rule.getOrder());
        this.anomaly=RulesAnalyse.NOANOMALY;
    }
    
    public void setParameter(int field, String value)
    {
        switch (field)
        {
            case PROTOCOL : this.setProtocol(value);
                break;
            case SRC_IP : this.setSrcIp(value);
                break;
            case SRC_PORT : this.setSrcPort(value);
                break;
            case DEST_IP : this.setDestIp(value);
                break;
            case DEST_PORT : this.setDestPort(value);
                break;
            case ACTION : this.setAction(value);
                break;         
        }
    }
    public String getParameter(int field)
    {
        switch (field)
        {
            case PROTOCOL : return this.getProtocol();
            case SRC_IP : return this.getSrcIp();
            case SRC_PORT : return this.getSrcPort();
            case DEST_IP : return this.getDestIp();
            case DEST_PORT : return this.getDestPort();
            case ACTION : return this.getAction();
            default : return "";
        }
    }
    public void setAnomaly(int anomaly)
    {
        this.anomaly=anomaly;
    }
}
